package Day31;

import Day26.Manager;

public class HomeWork5 {
    public static void main(String[] args) {
        Manger m1 = new Manger("虾粥",2000,2000);
        Employer e1 = new Employer("小黄",3000);
        System.out.println(showEmpAnnual(e1));
        testWork(m1);
        testWork(e1);

    }

    public static double showEmpAnnual(Employee e){
        if(e instanceof Employer){
            Employer e1 = (Employer)e;
            return e1.getAnnual();
        }else if(e instanceof Manger){
            Manger m1 = (Manger)e;
            return m1.getAnnual();
        }else{
            System.out.println("你的类型输入错误了");
            return -1;
        }
    }

    public static void testWork(Employee e){
        if(e instanceof Employer){
            Employer e1 = (Employer)e;
            e1.work();
        }else if(e instanceof Manger){
            Manger m1 = (Manger)e;
            m1.manage();
        }
    }


}

